package org.linlinjava.litemall.db.domain;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.ArrayList;
import java.util.Arrays;

@TableName("litemall_subscribe_user")
public class LitemallSubscribeUser {
    public static final Boolean IS_DELETED = Deleted.IS_DELETED.value();

    public static final Boolean NOT_DELETED = Deleted.NOT_DELETED.value();

    @TableId
    private Integer id;

    private Integer subscribeId;

    private Integer userId;

    private Integer shopId;

    private Integer goodsId;

    private Integer goodsProductId;

    private Integer number;

    private String goodsItem;

    private BigDecimal price;

    private BigDecimal taxPrice;

    private Integer addressId;

    private Byte method;

    private Byte deliveryMethod;

    private Integer deliveryDays;

    private LocalTime deliveryStartTime;

    private LocalTime deliveryEndTime;

    private LocalDateTime startTime;

    private LocalDateTime endTime;

    private Boolean autoSub;

    private Byte autoPayType;

    private Integer autoPayId;

    private Integer linkId;

    private String remark;

    private Boolean status;

    private LocalDateTime addTime;

    private LocalDateTime updateTime;

    private Boolean deleted;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getSubscribeId() {
        return subscribeId;
    }

    public void setSubscribeId(Integer subscribeId) {
        this.subscribeId = subscribeId;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getShopId() {
        return shopId;
    }

    public void setShopId(Integer shopId) {
        this.shopId = shopId;
    }

    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }

    public Integer getGoodsProductId() {
        return goodsProductId;
    }

    public void setGoodsProductId(Integer goodsProductId) {
        this.goodsProductId = goodsProductId;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getGoodsItem() {
        return goodsItem;
    }

    public void setGoodsItem(String goodsItem) {
        this.goodsItem = goodsItem;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getTaxPrice() {
        return taxPrice;
    }

    public void setTaxPrice(BigDecimal taxPrice) {
        this.taxPrice = taxPrice;
    }

    public Integer getAddressId() {
        return addressId;
    }

    public void setAddressId(Integer addressId) {
        this.addressId = addressId;
    }

    public Byte getMethod() {
        return method;
    }

    public void setMethod(Byte method) {
        this.method = method;
    }

    public Byte getDeliveryMethod() {
        return deliveryMethod;
    }

    public void setDeliveryMethod(Byte deliveryMethod) {
        this.deliveryMethod = deliveryMethod;
    }

    public Integer getDeliveryDays() {
        return deliveryDays;
    }

    public void setDeliveryDays(Integer deliveryDays) {
        this.deliveryDays = deliveryDays;
    }

    public LocalTime getDeliveryStartTime() {
        return deliveryStartTime;
    }

    public void setDeliveryStartTime(LocalTime deliveryStartTime) {
        this.deliveryStartTime = deliveryStartTime;
    }

    public LocalTime getDeliveryEndTime() {
        return deliveryEndTime;
    }

    public void setDeliveryEndTime(LocalTime deliveryEndTime) {
        this.deliveryEndTime = deliveryEndTime;
    }

    public LocalDateTime getStartTime() {
        return startTime;
    }

    public void setStartTime(LocalDateTime startTime) {
        this.startTime = startTime;
    }

    public LocalDateTime getEndTime() {
        return endTime;
    }

    public void setEndTime(LocalDateTime endTime) {
        this.endTime = endTime;
    }

    public Boolean getAutoSub() {
        return autoSub;
    }

    public void setAutoSub(Boolean autoSub) {
        this.autoSub = autoSub;
    }

    public Byte getAutoPayType() {
        return autoPayType;
    }

    public void setAutoPayType(Byte autoPayType) {
        this.autoPayType = autoPayType;
    }

    public Integer getAutoPayId() {
        return autoPayId;
    }

    public void setAutoPayId(Integer autoPayId) {
        this.autoPayId = autoPayId;
    }

    public Integer getLinkId() {
        return linkId;
    }

    public void setLinkId(Integer linkId) {
        this.linkId = linkId;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    public LocalDateTime getAddTime() {
        return addTime;
    }

    public void setAddTime(LocalDateTime addTime) {
        this.addTime = addTime;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public void andLogicalDeleted(boolean deleted) {
        setDeleted(deleted ? Deleted.IS_DELETED.value() : Deleted.NOT_DELETED.value());
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", IS_DELETED=").append(IS_DELETED);
        sb.append(", NOT_DELETED=").append(NOT_DELETED);
        sb.append(", id=").append(id);
        sb.append(", subscribeId=").append(subscribeId);
        sb.append(", userId=").append(userId);
        sb.append(", shopId=").append(shopId);
        sb.append(", goodsId=").append(goodsId);
        sb.append(", goodsProductId=").append(goodsProductId);
        sb.append(", number=").append(number);
        sb.append(", goodsItem=").append(goodsItem);
        sb.append(", price=").append(price);
        sb.append(", taxPrice=").append(taxPrice);
        sb.append(", addressId=").append(addressId);
        sb.append(", method=").append(method);
        sb.append(", deliveryMethod=").append(deliveryMethod);
        sb.append(", deliveryDays=").append(deliveryDays);
        sb.append(", deliveryStartTime=").append(deliveryStartTime);
        sb.append(", deliveryEndTime=").append(deliveryEndTime);
        sb.append(", startTime=").append(startTime);
        sb.append(", endTime=").append(endTime);
        sb.append(", autoSub=").append(autoSub);
        sb.append(", autoPayType=").append(autoPayType);
        sb.append(", autoPayId=").append(autoPayId);
        sb.append(", linkId=").append(linkId);
        sb.append(", remark=").append(remark);
        sb.append(", status=").append(status);
        sb.append(", addTime=").append(addTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", deleted=").append(deleted);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        LitemallSubscribeUser other = (LitemallSubscribeUser) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getSubscribeId() == null ? other.getSubscribeId() == null : this.getSubscribeId().equals(other.getSubscribeId()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
            && (this.getGoodsId() == null ? other.getGoodsId() == null : this.getGoodsId().equals(other.getGoodsId()))
            && (this.getGoodsProductId() == null ? other.getGoodsProductId() == null : this.getGoodsProductId().equals(other.getGoodsProductId()))
            && (this.getNumber() == null ? other.getNumber() == null : this.getNumber().equals(other.getNumber()))
            && (this.getGoodsItem() == null ? other.getGoodsItem() == null : this.getGoodsItem().equals(other.getGoodsItem()))
            && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
            && (this.getTaxPrice() == null ? other.getTaxPrice() == null : this.getTaxPrice().equals(other.getTaxPrice()))
            && (this.getAddressId() == null ? other.getAddressId() == null : this.getAddressId().equals(other.getAddressId()))
            && (this.getMethod() == null ? other.getMethod() == null : this.getMethod().equals(other.getMethod()))
            && (this.getDeliveryMethod() == null ? other.getDeliveryMethod() == null : this.getDeliveryMethod().equals(other.getDeliveryMethod()))
            && (this.getDeliveryDays() == null ? other.getDeliveryDays() == null : this.getDeliveryDays().equals(other.getDeliveryDays()))
            && (this.getDeliveryStartTime() == null ? other.getDeliveryStartTime() == null : this.getDeliveryStartTime().equals(other.getDeliveryStartTime()))
            && (this.getDeliveryEndTime() == null ? other.getDeliveryEndTime() == null : this.getDeliveryEndTime().equals(other.getDeliveryEndTime()))
            && (this.getStartTime() == null ? other.getStartTime() == null : this.getStartTime().equals(other.getStartTime()))
            && (this.getEndTime() == null ? other.getEndTime() == null : this.getEndTime().equals(other.getEndTime()))
            && (this.getAutoSub() == null ? other.getAutoSub() == null : this.getAutoSub().equals(other.getAutoSub()))
            && (this.getAutoPayType() == null ? other.getAutoPayType() == null : this.getAutoPayType().equals(other.getAutoPayType()))
            && (this.getAutoPayId() == null ? other.getAutoPayId() == null : this.getAutoPayId().equals(other.getAutoPayId()))
            && (this.getLinkId() == null ? other.getLinkId() == null : this.getLinkId().equals(other.getLinkId()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getSubscribeId() == null) ? 0 : getSubscribeId().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
        result = prime * result + ((getGoodsId() == null) ? 0 : getGoodsId().hashCode());
        result = prime * result + ((getGoodsProductId() == null) ? 0 : getGoodsProductId().hashCode());
        result = prime * result + ((getNumber() == null) ? 0 : getNumber().hashCode());
        result = prime * result + ((getGoodsItem() == null) ? 0 : getGoodsItem().hashCode());
        result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
        result = prime * result + ((getTaxPrice() == null) ? 0 : getTaxPrice().hashCode());
        result = prime * result + ((getAddressId() == null) ? 0 : getAddressId().hashCode());
        result = prime * result + ((getMethod() == null) ? 0 : getMethod().hashCode());
        result = prime * result + ((getDeliveryMethod() == null) ? 0 : getDeliveryMethod().hashCode());
        result = prime * result + ((getDeliveryDays() == null) ? 0 : getDeliveryDays().hashCode());
        result = prime * result + ((getDeliveryStartTime() == null) ? 0 : getDeliveryStartTime().hashCode());
        result = prime * result + ((getDeliveryEndTime() == null) ? 0 : getDeliveryEndTime().hashCode());
        result = prime * result + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
        result = prime * result + ((getEndTime() == null) ? 0 : getEndTime().hashCode());
        result = prime * result + ((getAutoSub() == null) ? 0 : getAutoSub().hashCode());
        result = prime * result + ((getAutoPayType() == null) ? 0 : getAutoPayType().hashCode());
        result = prime * result + ((getAutoPayId() == null) ? 0 : getAutoPayId().hashCode());
        result = prime * result + ((getLinkId() == null) ? 0 : getLinkId().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
        return result;
    }

    public enum Deleted {
        NOT_DELETED(new Boolean("0"), "未删除"),
        IS_DELETED(new Boolean("1"), "已删除");

        private final Boolean value;

        private final String name;

        Deleted(Boolean value, String name) {
            this.value = value;
            this.name = name;
        }

        public Boolean getValue() {
            return this.value;
        }

        public Boolean value() {
            return this.value;
        }

        public String getName() {
            return this.name;
        }
    }

    public enum Column {
        id("id", "id", "INTEGER", false),
        subscribeId("subscribe_id", "subscribeId", "INTEGER", false),
        userId("user_id", "userId", "INTEGER", false),
        shopId("shop_id", "shopId", "INTEGER", false),
        goodsId("goods_id", "goodsId", "INTEGER", false),
        goodsProductId("goods_product_id", "goodsProductId", "INTEGER", false),
        number("number", "number", "INTEGER", true),
        goodsItem("goods_item", "goodsItem", "VARCHAR", false),
        price("price", "price", "DECIMAL", false),
        taxPrice("tax_price", "taxPrice", "DECIMAL", false),
        addressId("address_id", "addressId", "INTEGER", false),
        method("method", "method", "TINYINT", true),
        deliveryMethod("delivery_method", "deliveryMethod", "TINYINT", false),
        deliveryDays("delivery_days", "deliveryDays", "INTEGER", false),
        deliveryStartTime("delivery_start_time", "deliveryStartTime", "TIME", false),
        deliveryEndTime("delivery_end_time", "deliveryEndTime", "TIME", false),
        startTime("start_time", "startTime", "TIMESTAMP", false),
        endTime("end_time", "endTime", "TIMESTAMP", false),
        autoSub("auto_sub", "autoSub", "BIT", false),
        autoPayType("auto_pay_type", "autoPayType", "TINYINT", false),
        autoPayId("auto_pay_id", "autoPayId", "INTEGER", false),
        linkId("link_id", "linkId", "INTEGER", false),
        remark("remark", "remark", "VARCHAR", false),
        status("status", "status", "BIT", true),
        addTime("add_time", "addTime", "TIMESTAMP", false),
        updateTime("update_time", "updateTime", "TIMESTAMP", false),
        deleted("deleted", "deleted", "BIT", false);

        private static final String BEGINNING_DELIMITER = "`";

        private static final String ENDING_DELIMITER = "`";

        private final String column;

        private final boolean isColumnNameDelimited;

        private final String javaProperty;

        private final String jdbcType;

        public String value() {
            return this.column;
        }

        public String getValue() {
            return this.column;
        }

        public String getJavaProperty() {
            return this.javaProperty;
        }

        public String getJdbcType() {
            return this.jdbcType;
        }

        Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
            this.column = column;
            this.javaProperty = javaProperty;
            this.jdbcType = jdbcType;
            this.isColumnNameDelimited = isColumnNameDelimited;
        }

        public String desc() {
            return this.getEscapedColumnName() + " DESC";
        }

        public String asc() {
            return this.getEscapedColumnName() + " ASC";
        }

        public static Column[] excludes(Column ... excludes) {
            ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
            if (excludes != null && excludes.length > 0) {
                columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
            }
            return columns.toArray(new Column[]{});
        }

        public String getEscapedColumnName() {
            if (this.isColumnNameDelimited) {
                return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
            } else {
                return this.column;
            }
        }

        public String getAliasedEscapedColumnName() {
            return this.getEscapedColumnName();
        }
    }
}